package com.graduation.sports.ui.fragment;

import android.content.Intent;
import android.text.InputType;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;
import com.graduation.sports.R;
import com.graduation.sports.base.BaseFragment;
import com.graduation.sports.config.Session;
import com.graduation.sports.ui.login.SportsLoginActivity;
import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;

import butterknife.BindView;
import butterknife.OnClick;


/**
 * @ProjectName: sports
 * @Package: com.graduation.sports.ui.fragment
 * @ClassName: MeFragment
 * @Description: java类作用描述
 * @Author: APC
 * @CreateDate: 2021/2/25 9:01
 * @Version: 1.0
 */
public class MeFragment extends BaseFragment {
    @BindView(R.id.btn_logout)
    Button btnLogout;
//    @BindView(R.id.tv_target_step)
//    TextView tvTargetStep;
    private TextView username;
    private TextView gender;
    private TextView grade;

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_mine;
    }

    @Override
    protected void initEventAndData() {
        username = getLayoutView().findViewById(R.id.tv_username);
        gender = getLayoutView().findViewById(R.id.tv_gender);
        grade = getLayoutView().findViewById(R.id.tv_grade);

        username.setText(Session.getUserInfo().getUserName());
        gender.setText(Session.getUserInfo().getGender());
        grade.setText(getContext().getResources().getStringArray(R.array.gradeNames)[Session.getUserInfo().getGrade() - 1]);

        btnLogout.setOnClickListener(v -> new XPopup.Builder(getActivity())
                .asConfirm("确认退出登录？", "", () -> {
                    startActivity(new Intent(getActivity(), SportsLoginActivity.class));
                    getActivity().finish();
                }).show());
    }

//    @OnClick({R.id.label_target_step, R.id.tv_target_step})
//    public void onViewClick(View view){
//        int id = view.getId();
//        switch (id) {
//            case R.id.label_target_step:
//            case R.id.tv_target_step:
//                break;
//        }
//    }



}
